<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增创业津贴奖励配置')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-allowanceAward-edit">
        <input type="hidden" th:value="${allowanceAward.id}" name="id">
        <div class="form-group">
            <label class="col-sm-3 control-label">活动名称：</label>
            <div class="col-sm-8">
                <input name="actName" th:value="${allowanceAward.actName}" maxlength="50" required class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">展业端管理编号：</label>
            <div class="col-sm-8">
                <input name="agentNum" th:value="${allowanceAward.agentNum}" onclick="selectAllAgent()" readonly id="teamAgentNum" type="text" class="form-control" required>
                <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">展业端管理名称：</label>
            <div class="col-sm-8">
                <input name="agentName"  th:value="${allowanceAward.agentName}" class="form-control" id="teamAgentName" type="text" required readonly>
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">类型：</label>
            <div class="col-sm-8">
                <select name="type" th:value="${allowanceAward.type}" class="form-control m-b" required>
                    <option value="">请选择</option>
                    <option th:selected="${allowanceAward.type == 1}" value="1">团长</option>
                    <option th:selected="${allowanceAward.type == 2}" value="2">资深总监</option>
                </select>
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">活动状态：</label>
            <div class="col-sm-8">
                <select name="status" th:value="${allowanceAward.status}" class="form-control m-b" required>
                    <option value="">请选择</option>
                    <option th:selected="${allowanceAward.status == 1}" value="1">启用</option>
                    <option th:selected="${allowanceAward.status == 0}" value="0">禁用</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">团队类型：</label>
            <div class="col-sm-8">
                <select name="teamType"  th:value="${allowanceAward.teamType}" class="form-control m-b">
                    <option th:selected="${allowanceAward.teamType == 1}" value="1">老团</option>
                    <option th:selected="${allowanceAward.teamType == 2}" value="2">新团</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">累计交易量金额：</label>
            <div class="col-sm-8">
                <input name="totalMoney" th:value="${allowanceAward.totalMoney}" maxlength="10" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">奖励比例：</label>
            <div class="col-sm-8">
                <input name="award" th:value="${allowanceAward.award}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">活动开始时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="actStartDate" th:value="${allowanceAward.actStartDate}" required class="form-control" placeholder="yyyy-MM-dd" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">活动结束时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="actEndDate"  th:value="${allowanceAward.actEndDate}" required class="form-control" placeholder="yyyy-MM-dd" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: utils-js" />
<script th:inline="javascript">
    var prefix = ctx + "team/allowanceAward"
    var teamInfo = ctx + "team/teamYlInfo"
    $("#form-allowanceAward-add").validate({
        focusCleanup: true
    });

    $("input[name='actStartDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
    $("input[name='actEndDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    /**
     * 选择展业端管理
     */
    function selectAllAgent() {
        var url =teamInfo+ "/selectAllAgent";
        $.modal.open("选择展业端管理信息" , url, '1100',"500");
    }

    function submitHandler() {
        if ($.validate.form()) {
            if (!$.vali.money($("input[name='totalMoney']").val())){
                $.modal.alertError("请输入正确的累计交易量金额");
                return;
            }
            $.operate.save(prefix + "/edit", $('#form-allowanceAward-edit').serialize());
        }
    }
</script>
</body>
</html>